package com.mercury.tests;
import java.util.List;
import org.hibernate.*;
import com.mercury.beans.Customer;
import com.mercury.beans.HibernateUtil;

public class Test5a {

	@SuppressWarnings("unchecked")
	public static void main(String[] args) {
		Session session = HibernateUtil.currentSession();
		
		String hql = "from Customer";
		List<Customer> list = session.createQuery(hql).list();
		for (Customer c:list){
			System.out.println(c.getCid() + "\t" + c.getName());
			for(String email:c.getEmails()){
				System.out.println(email);
			}
		}
		HibernateUtil.closeSession();
	}
}
